//
//  AllotOrderDetailView.m
//  TryShopping
//
//  Created by panquanReabam.com on 16/9/18.
//  Copyright © 2016年 RuiBen. All rights reserved.
//

#import "AllotOrderDetailView.h"

#import "GoodsView.h"
@interface AllotOrderDetailView()
@property(nonatomic,strong)UIView*amountView;
@property(nonatomic,strong)UILabel*noLabel;
@property(nonatomic,strong)UILabel*createNameLabel;
@property(nonatomic,strong)UILabel*createName;
@property(nonatomic,strong)UILabel*orderDate;
@property(nonatomic,strong)UILabel*orderDateLabel;
@property(nonatomic,strong)UILabel*totalQuantity;
@property(nonatomic,strong)UIButton*whsOutTypeName;
@property(nonatomic,strong)UIButton*whsName;
@property(nonatomic,strong)UIButton*whsName1;
@property(nonatomic,strong)UILabel*stateLabel;
@property(nonatomic,strong)UILabel*stateLabel1;

@end
@implementation AllotOrderDetailView
{
    NSMutableArray*whsOutItem;
    GoodsView*GoodView;
    NSString*payType;
    NSString*changdu;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
    }
    return self;
}
#pragma mark InitUI
- (void)initUI
{
    self .backgroundColor = zuiqianhuiColor;
    
    UIView*view1=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 70)];
    view1.backgroundColor=[UIColor whiteColor];
    [self addSubview:view1];
    _noLabel=[[UILabel alloc]init];
    _noLabel.textColor=qianheiColor;
    _noLabel.font=[UIFont systemFontOfSize:17];
    [view1 addSubview:_noLabel];
    
    
    
    _stateLabel=[[UILabel alloc]init];
    _stateLabel.textColor=luseColor;
    _stateLabel.textAlignment=NSTextAlignmentCenter;
    _stateLabel.font=[UIFont systemFontOfSize:Statusfot];
    [self addSubview:_stateLabel];
    
    
    _stateLabel1=[[UILabel alloc]init];
    _stateLabel1.textColor=luseColor;
    _stateLabel1.font=[UIFont systemFontOfSize:Statusfot];
    [self addSubview:_stateLabel1];

    UILabel *line1=[[UILabel alloc] initWithFrame:CGRectMake(0, 70, ScreenWidth, 0.40)];
    line1.backgroundColor=qianhuiColor;
    [view1 addSubview:line1];
    _createName=[[UILabel alloc]init];
    _createName.text=[NSString stringWithFormat:@"员工"];
    _createName.textColor=zhonghuiColor;
    _createName.font=[UIFont systemFontOfSize:contenfot];
    [view1 addSubview:_createName];
    _createNameLabel=[[UILabel alloc]init];
    _createNameLabel.textColor=shenhuiColor;
    _createNameLabel.font=[UIFont systemFontOfSize:contenfot];
    [view1 addSubview:_createNameLabel];
    
    _orderDate=[[UILabel alloc]init];
    _orderDate.text=@"日期";
    _orderDate.textColor=zhonghuiColor;
    _orderDate.font=[UIFont systemFontOfSize:contenfot];
    [view1 addSubview:_orderDate];
    
    _orderDateLabel=[[UILabel alloc]init];
    _orderDateLabel.textColor=shenhuiColor;
    _orderDateLabel.font=[UIFont systemFontOfSize:contenfot];
    [view1 addSubview:_orderDateLabel];
    
    UIView*view2=[[UIView alloc]initWithFrame:CGRectMake(0, view1.bottom+10, ScreenWidth, 45*3)];
    view2.backgroundColor=[UIColor whiteColor];
    view2.layer.borderWidth = 0.40;
    view2.layer.borderColor = qianhuiColor.CGColor;
    [self addSubview:view2];
    
    UILabel *line3=[[UILabel alloc] initWithFrame:CGRectMake(10,  45, ScreenWidth-20, 0.40)];
    line3.backgroundColor=qianhuiColor;
    [view2 addSubview:line3];
    UILabel*type=[[UILabel alloc]initWithFrame:CGRectMake(15,0, 200, 45)];
    type.text=@"类型";
    type.textColor=shenhuiColor;
    type.font=[UIFont systemFontOfSize:contenfot];
    [view2 addSubview:type];
    
    _whsOutTypeName=[[UIButton alloc]initWithFrame:CGRectMake(30,  0, ScreenWidth-50,45)];
    _whsOutTypeName.titleLabel.font=[UIFont systemFontOfSize:contenfot];
    _whsOutTypeName.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
    [_whsOutTypeName setTitleColor:qianheiColor forState:UIControlStateNormal];
    [view2 addSubview:_whsOutTypeName];
    
    UILabel*whsLabel=[[UILabel alloc]initWithFrame:CGRectMake(15,45, 200, 45)];
    whsLabel.text=@"从仓库";
    whsLabel.textColor=shenhuiColor;
    whsLabel.font=[UIFont systemFontOfSize:contenfot];
    [view2 addSubview:whsLabel];
    
    _whsName=[[UIButton alloc]initWithFrame:CGRectMake(30,  45, ScreenWidth-50,45)];
    _whsName.titleLabel.font=[UIFont systemFontOfSize:contenfot];
    _whsName.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
    [_whsName setTitleColor:qianheiColor forState:UIControlStateNormal];
    [view2 addSubview:_whsName];
    
    UILabel *line4=[[UILabel alloc] initWithFrame:CGRectMake(10,  90, ScreenWidth-20, 0.40)];
    line4.backgroundColor=qianhuiColor;
    [view2 addSubview:line4];
    
    
    UILabel*whsLabel1=[[UILabel alloc]initWithFrame:CGRectMake(15,90, 200, 45)];
    whsLabel1.text=@"到仓库";
    whsLabel1.textColor=shenhuiColor;
    whsLabel1.font=[UIFont systemFontOfSize:contenfot];
    [view2 addSubview:whsLabel1];
    
    _whsName1=[[UIButton alloc]initWithFrame:CGRectMake(30,  90, ScreenWidth-50,45)];
    _whsName1.titleLabel.font=[UIFont systemFontOfSize:contenfot];
    _whsName1.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
    [_whsName1 setTitleColor:qianheiColor forState:UIControlStateNormal];
    [view2 addSubview:_whsName1];
    
    UIView*view3=[[UIView alloc]initWithFrame:CGRectMake(0, view2.bottom+10, ScreenWidth, 45)];
    view3.backgroundColor=[UIColor whiteColor];
    [self addSubview:view3];
    UILabel *line5=[[UILabel alloc] initWithFrame:CGRectMake(0,  0, ScreenWidth, 0.40)];
    line5.backgroundColor=qianhuiColor;
    [view3 addSubview:line5];
    UILabel *line6=[[UILabel alloc] initWithFrame:CGRectMake(10,  45-0.40, ScreenWidth-20, 0.40)];
    line6.backgroundColor=qianhuiColor;
    [view3 addSubview:line6];
    UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 80, 45)];
    shangpingxinxi.text=@"商品信息";
    shangpingxinxi.textColor=qianheiColor;
    shangpingxinxi.font=[UIFont systemFontOfSize:15];
    [view3 addSubview:shangpingxinxi];
    _totalQuantity=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-250, 0, 230, 45)];
    
    _totalQuantity.textColor = [UIColor colorWithRed:5.00/255.0 green:18.0/255.0 blue:40.00/255.0 alpha:1];
    _totalQuantity.textAlignment = NSTextAlignmentRight;
    _totalQuantity.font = [UIFont systemFontOfSize:16];
    [view3 addSubview:_totalQuantity];
    
    _heightView=[[UIView alloc]init];
    _heightView.backgroundColor=qianhuiColor;
    [self addSubview:_heightView];
    
}
-(void)setModel:(AllotOrderDetailModel *)model{

    [self initUI];
    [self setViewAutoLayout];
    
    if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"allotType"] isEqualToString:@"转出"]) {
        self.stateLabel.textColor=[UIColor whiteColor];
        self.stateLabel.backgroundColor=[UIColor colorWithRed:252/255.0 green:102/255.0 blue:33/255.0 alpha:1];
        self.stateLabel.text=[NSString stringWithFormat:@"%@ " ,@"转出"];
        self.stateLabel.font=[UIFont systemFontOfSize:11];
    }else{
        self.stateLabel.textColor=[UIColor whiteColor];
        self.stateLabel.backgroundColor=luseColor;
        self.stateLabel.font=[UIFont systemFontOfSize:11];
        self.stateLabel.text=[NSString stringWithFormat:@"%@ " ,@"转入"];
        
    }
    if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"NA"]) {
        self.stateLabel1.textColor=shenhongseColor;
    }else
        if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YR"]) {
            self.stateLabel1.textColor=shenhongseColor;
        }else{
            
            self.stateLabel1.textColor=luseColor;
        }

    self.stateLabel1.text=[NSString stringWithFormat:@"%@ " ,[[model.dict objectForKey:@"orderData"]objectForKey:@"statusName"] ];


    _noLabel.text=[[model.dict objectForKey:@"orderData"]objectForKey:@"orderNo"];
    _createNameLabel.text=[[model.dict objectForKey:@"orderData"]objectForKey:@"createName"];
    _orderDateLabel.text=[[model.dict objectForKey:@"orderData"]objectForKey:@"createDate"];
    [_whsOutTypeName setTitle:[[model.dict objectForKey:@"orderData"]objectForKey:@"typeName"] forState:UIControlStateNormal];
    [_whsName setTitle:[[model.dict objectForKey:@"orderData"]objectForKey:@"outWhsName"] forState:UIControlStateNormal];
    [_whsName1 setTitle:[[model.dict objectForKey:@"orderData"]objectForKey:@"inWhsName"] forState:UIControlStateNormal];
    NSNumber*Total = [[model.dict objectForKey:@"orderData"]objectForKey:@"totalMoney"];
    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
    [numberFormatter setPositiveFormat:@"###,##0.00;"];
    NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:Total.doubleValue]];
    
    _totalQuantity.text=[NSString  stringWithFormat:@"共 %@ 件，  ￥%@",[[model.dict objectForKey:@"orderData"]objectForKey:@"totalQuantity"], formattedNumberString];
    NSMutableAttributedString *AttributedStr2 = [[NSMutableAttributedString alloc]initWithString:[NSString  stringWithFormat:@"共 %@ 件，  ￥%@",[[model.dict objectForKey:@"orderData"]objectForKey:@"totalQuantity"], formattedNumberString]];
    [AttributedStr2 addAttribute:NSFontAttributeName
     
                           value:[UIFont systemFontOfSize:13.0]
     
                           range:NSMakeRange(0, 8)];
    
    [AttributedStr2 addAttribute:NSForegroundColorAttributeName
     
                           value:zhonghuiColor
     
                           range:NSMakeRange(0, 8)];
    
    
    _totalQuantity.attributedText = AttributedStr2;
    
    whsOutItem=[[model.dict objectForKey:@"orderData"]  objectForKey:@"items"];
    
   if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YO"]&&[[[model.dict objectForKey:@"orderData"]objectForKey:@"isCurrent"] isEqualToString:@"Y"]) {
       
       changdu=@"130";
      
  }else   if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YI"]&&[[[model.dict objectForKey:@"orderData"]objectForKey:@"isCurrent"] isEqualToString:@"N"]) {
      
      changdu=@"130";
  
  }else   if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YO"]&&[[[model.dict objectForKey:@"orderData"]objectForKey:@"isCurrent"] isEqualToString:@"N"]) {
      
      changdu=@"130";
      
  }else   if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YI"]&&[[[model.dict objectForKey:@"orderData"]objectForKey:@"isCurrent"] isEqualToString:@"Y"]) {
      
      changdu=@"130";
      
  }
  
  else{
      changdu=@"120";

  
  }

    if (whsOutItem.count>0) {
        
        for (int i = 0; i<whsOutItem.count; i++) {
            
            GoodView = [[GoodsView alloc]initWithFrame:CGRectMake(0, 70+45*3+65+(changdu.intValue*i), ScreenWidth, changdu.intValue)];
            GoodView.backgroundColor=[UIColor whiteColor];
            [GoodView.headImageFull setImageWithURL:[[whsOutItem objectAtIndex:i] objectForKey:@"imageUrlFull"] placeholderImage:[UIImage imageNamed:@"zhengfangxing"]];
            [GoodView.headImageFull.layer setCornerRadius:6.0];
            [GoodView.headImageFull.layer setBorderWidth:0.5];
            [GoodView.headImageFull.layer setMasksToBounds:YES];
            CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
            CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){ 0.93, 0.93, 0.93, 0.93 });
            [GoodView.headImageFull.layer setBorderColor:colorref2];//边框颜色
            
            GoodView.itemName.text=[NSString stringWithFormat:@"%@ %@",[[whsOutItem objectAtIndex:i] objectForKey:@"itemCode"],[[whsOutItem objectAtIndex:i] objectForKey:@"itemName"]];
            
            GoodView.quantity.text=[NSString stringWithFormat:@"数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"quantity"]];
            
            NSMutableAttributedString *AttributedStr1 = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"quantity"]]];
            
            [AttributedStr1 addAttribute:NSFontAttributeName
             
                                   value:[UIFont systemFontOfSize:13]
             
                                   range:NSMakeRange(0, 3)];
            
            [AttributedStr1 addAttribute:NSForegroundColorAttributeName
             
                                   value:zhonghuiColor
             
                                   range:NSMakeRange(0, 3)];
            
            
            GoodView.quantity.attributedText = AttributedStr1;
            
            
            NSNumber*Total =[[whsOutItem objectAtIndex:i] objectForKey:@"salePrice"];
            
            NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
            [numberFormatter setPositiveFormat:@"###,##0.00;"];
            NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:Total.doubleValue]];
            GoodView.dealPrice.text=[NSString stringWithFormat:@"¥ %@",formattedNumberString];
            GoodView.dealPrice.textColor=qianheiColor;
            GoodView.itemType.text=[NSString stringWithFormat:@"%@",[[whsOutItem objectAtIndex:i] objectForKey:@"specName"]];
            
            NSMutableAttributedString *AttributedStr12 = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"¥ %@",formattedNumberString]];
            
            [AttributedStr12 addAttribute:NSFontAttributeName
             
                                    value:[UIFont systemFontOfSize:contenfot]
             
                                    range:NSMakeRange(0, 1)];
            
            [AttributedStr12 addAttribute:NSForegroundColorAttributeName
             
                                    value:shenhuiColor
             
                                    range:NSMakeRange(0, 1)];
            
            
            GoodView.dealPrice.attributedText = AttributedStr12;
            
         if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YO"]&&[[[model.dict objectForKey:@"orderData"]objectForKey:@"isCurrent"] isEqualToString:@"Y"]) {
              UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(110, 105, 180, 13)];
              shangpingxinxi.text=[NSString stringWithFormat:@"发货数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"outQuantity"]];
              shangpingxinxi.textColor=luseColor;
              shangpingxinxi.font=[UIFont systemFontOfSize:12];
              [GoodView addSubview:shangpingxinxi];

          
          }else   if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YI"]&&[[[model.dict objectForKey:@"orderData"]objectForKey:@"isCurrent"] isEqualToString:@"N"]) {
              
              UIFont *font1 = [UIFont systemFontOfSize:12];
              CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
              CGSize labelsize1 = [[NSString stringWithFormat:@"发货数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"outQuantity"]] sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
              
              UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(110, 105, labelsize1.width+5, 13)];
              shangpingxinxi.text=[NSString stringWithFormat:@"发货数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"outQuantity"]];
              shangpingxinxi.textColor=luseColor;
              shangpingxinxi.font=[UIFont systemFontOfSize:12];
              [GoodView addSubview:shangpingxinxi];
              
              UILabel*shangpingxinxi1=[[UILabel alloc]initWithFrame:CGRectMake(shangpingxinxi.right+5, 105, 180, 13)];
              shangpingxinxi1.text=[NSString stringWithFormat:@"收货数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"inQuantity"]];
              shangpingxinxi1.textColor=luseColor;
              shangpingxinxi1.font=[UIFont systemFontOfSize:12];
              [GoodView addSubview:shangpingxinxi1];

          }else   if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YI"]&&[[[model.dict objectForKey:@"orderData"]objectForKey:@"isCurrent"] isEqualToString:@"Y"]) {
              
              
              UIFont *font1 = [UIFont systemFontOfSize:12];
              CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
              CGSize labelsize1 = [[NSString stringWithFormat:@"发货数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"outQuantity"]] sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
              
              UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(110, 105, labelsize1.width+5, 13)];
              shangpingxinxi.text=[NSString stringWithFormat:@"发货数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"outQuantity"]];
              shangpingxinxi.textColor=luseColor;
              shangpingxinxi.font=[UIFont systemFontOfSize:12];
              [GoodView addSubview:shangpingxinxi];
              
              UILabel*shangpingxinxi1=[[UILabel alloc]initWithFrame:CGRectMake(shangpingxinxi.right+5, 105, 180, 13)];
              shangpingxinxi1.text=[NSString stringWithFormat:@"收货数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"inQuantity"]];
              shangpingxinxi1.textColor=luseColor;
              shangpingxinxi1.font=[UIFont systemFontOfSize:12];
              [GoodView addSubview:shangpingxinxi1];
              
              
          }
          
          else    if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"] isEqualToString:@"YO"]&&[[[model.dict objectForKey:@"orderData"]objectForKey:@"isCurrent"] isEqualToString:@"N"]) {
              UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(110, 105, 180, 13)];
              shangpingxinxi.text=[NSString stringWithFormat:@"发货数量 %@",[[whsOutItem objectAtIndex:i] objectForKey:@"outQuantity"]];
              shangpingxinxi.textColor=luseColor;
              shangpingxinxi.font=[UIFont systemFontOfSize:12];
              [GoodView addSubview:shangpingxinxi];
              
          }

            
        if (i==whsOutItem.count-1) {
                UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(0, changdu.intValue-0.40, ScreenWidth, 0.40)];
                lineLabel1.backgroundColor=qianhuiColor;
                [GoodView addSubview:lineLabel1];
            }else{
                UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(10, changdu.intValue-0.40, ScreenWidth-20, 0.40)];
                lineLabel1.backgroundColor=qianhuiColor;
                [GoodView addSubview:lineLabel1];
            }
            [self addSubview:GoodView];
            
        }
        
    }
    
    
    UIView*view6=[[UIView alloc]initWithFrame:CGRectMake(0, GoodView.bottom+10, ScreenWidth, 80)];
    view6.backgroundColor=[UIColor whiteColor];
    view6.layer.borderWidth = 0.50;
    view6.layer.borderColor = qianhuiColor.CGColor;
    [self addSubview:view6];
    
    UILabel*remarkLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, ScreenWidth*70/750, 40)];
    remarkLabel.text=@"备注";
    remarkLabel.font= [UIFont systemFontOfSize:contenfot];
    [remarkLabel setTextColor:qianheiColor];
    [view6 addSubview:remarkLabel];
    
    NSString *s1 = [[model.dict objectForKey:@"orderData"]objectForKey:@"remark"];
    if (s1.length>0) {
        
    }else{
    s1=@"无";
    
    }
    UIFont *font1 = [UIFont systemFontOfSize:contenfot];
    CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
    CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
    
    UILabel*remarkLabel1=[[UILabel alloc]initWithFrame:CGRectMake(15, remarkLabel.bottom, ScreenWidth-40, labelsize1.height+10)];
    remarkLabel1.text=s1;
    remarkLabel1.numberOfLines=0;
    remarkLabel1.font= [UIFont systemFontOfSize:contenfot];
    [remarkLabel1 setTextColor:shenhuiColor];
    [view6 addSubview:remarkLabel1];
    view6.frame=CGRectMake(0, GoodView.bottom+10, ScreenWidth, labelsize1.height+70);
    
    if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"]isEqualToString:@"YC"]) {
        UIView*cancelRemarkView=[[UIView alloc]initWithFrame:CGRectMake(0, view6.bottom+10, ScreenWidth, 80)];
        cancelRemarkView.backgroundColor=[UIColor whiteColor];
        cancelRemarkView.layer.borderWidth = 0.40;
        cancelRemarkView.layer.borderColor = qianhuiColor.CGColor;
        [self addSubview:cancelRemarkView];
        
        UILabel*cancelRemark=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 120, 40)];
        cancelRemark.text=@"取消信息";
        cancelRemark.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemark setTextColor:qianheiColor];
        [cancelRemarkView addSubview:cancelRemark];
        
        NSString *cancelRemarks = [[model.dict objectForKey:@"orderData"]objectForKey:@"cancelRemark"];
        if (cancelRemarks.length>0) {
            
        }else{
            cancelRemarks=@"无";
            
        }

        CGSize cancelRemarksize = [cancelRemarks sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        UILabel*cancelRemarkLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, remarkLabel.bottom, ScreenWidth-40, cancelRemarksize.height+10)];
        cancelRemarkLabel.text=cancelRemarks;
        cancelRemarkLabel.numberOfLines=0;
        cancelRemarkLabel.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemarkLabel setTextColor:shenhuiColor];
        [cancelRemarkView addSubview:cancelRemarkLabel];
        
        cancelRemarkView.frame=CGRectMake(0, view6.bottom+10, ScreenWidth, cancelRemarksize.height+70);
        _heightView.frame=CGRectMake(0, cancelRemarkView.bottom, ScreenWidth, 0.15);

    }else  if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"]isEqualToString:@"YA"]) {
        UIView*cancelRemarkView=[[UIView alloc]initWithFrame:CGRectMake(0, view6.bottom+10, ScreenWidth, 80)];
        cancelRemarkView.backgroundColor=[UIColor whiteColor];
        cancelRemarkView.layer.borderWidth = 0.40;
        cancelRemarkView.layer.borderColor = qianhuiColor.CGColor;
        [self addSubview:cancelRemarkView];
        
        UILabel*cancelRemark=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 120, 40)];
        cancelRemark.text=@"受理信息";
        cancelRemark.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemark setTextColor:qianheiColor];
        [cancelRemarkView addSubview:cancelRemark];
        
        NSString *cancelRemarks = [[model.dict objectForKey:@"orderData"]objectForKey:@"acceptRemark"];
        if (cancelRemarks.length>0) {
            
        }else{
            cancelRemarks=@"无";
            
        }
        
        CGSize cancelRemarksize = [cancelRemarks sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        UILabel*cancelRemarkLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, remarkLabel.bottom, ScreenWidth-40, cancelRemarksize.height+10)];
        cancelRemarkLabel.text=cancelRemarks;
        cancelRemarkLabel.numberOfLines=0;
        cancelRemarkLabel.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemarkLabel setTextColor:shenhuiColor];
        [cancelRemarkView addSubview:cancelRemarkLabel];
        
        cancelRemarkView.frame=CGRectMake(0, view6.bottom+10, ScreenWidth, cancelRemarksize.height+70);
        _heightView.frame=CGRectMake(0, cancelRemarkView.bottom, ScreenWidth, 0.15);
        
    }else    if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"]isEqualToString:@"YR"]) {
        UIView*cancelRemarkView=[[UIView alloc]initWithFrame:CGRectMake(0, view6.bottom+10, ScreenWidth, 80)];
        cancelRemarkView.backgroundColor=[UIColor whiteColor];
        cancelRemarkView.layer.borderWidth = 0.40;
        cancelRemarkView.layer.borderColor = qianhuiColor.CGColor;
        [self addSubview:cancelRemarkView];
        
        UILabel*cancelRemark=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 120, 40)];
        cancelRemark.text=@"拒绝信息";
        cancelRemark.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemark setTextColor:qianheiColor];
        [cancelRemarkView addSubview:cancelRemark];
        
        NSString *cancelRemarks = [[model.dict objectForKey:@"orderData"]objectForKey:@"refuseRemark"];
        if (cancelRemarks.length>0) {
            
        }else{
            cancelRemarks=@"无";
            
        }
        
        CGSize cancelRemarksize = [cancelRemarks sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        UILabel*cancelRemarkLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, remarkLabel.bottom, ScreenWidth-40, cancelRemarksize.height+10)];
        cancelRemarkLabel.text=cancelRemarks;
        cancelRemarkLabel.numberOfLines=0;
        cancelRemarkLabel.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemarkLabel setTextColor:shenhuiColor];
        [cancelRemarkView addSubview:cancelRemarkLabel];
        
        cancelRemarkView.frame=CGRectMake(0, view6.bottom+10, ScreenWidth, cancelRemarksize.height+70);
        _heightView.frame=CGRectMake(0, cancelRemarkView.bottom, ScreenWidth, 0.15);
        
    }else    if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"]isEqualToString:@"YO"]) {
        UIView*cancelRemarkView=[[UIView alloc]initWithFrame:CGRectMake(0, view6.bottom+10, ScreenWidth, 80)];
        cancelRemarkView.backgroundColor=[UIColor whiteColor];
        cancelRemarkView.layer.borderWidth = 0.40;
        cancelRemarkView.layer.borderColor = qianhuiColor.CGColor;
        [self addSubview:cancelRemarkView];
        
        UILabel*cancelRemark=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 120, 40)];
        cancelRemark.text=@"受理信息";
        cancelRemark.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemark setTextColor:qianheiColor];
        [cancelRemarkView addSubview:cancelRemark];
        
        NSString *cancelRemarks = [[model.dict objectForKey:@"orderData"]objectForKey:@"acceptRemark"];
        if (cancelRemarks.length>0) {
            
        }else{
            cancelRemarks=@"无";
            
        }
        
        CGSize cancelRemarksize = [cancelRemarks sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        UILabel*cancelRemarkLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, remarkLabel.bottom, ScreenWidth-40, cancelRemarksize.height+10)];
        cancelRemarkLabel.text=cancelRemarks;
        cancelRemarkLabel.numberOfLines=0;
        cancelRemarkLabel.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemarkLabel setTextColor:shenhuiColor];
        [cancelRemarkView addSubview:cancelRemarkLabel];
        
        cancelRemarkView.frame=CGRectMake(0, view6.bottom+10, ScreenWidth, cancelRemarksize.height+70);
        _heightView.frame=CGRectMake(0, cancelRemarkView.bottom, ScreenWidth, 0.15);

        
    }else    if ([[[model.dict objectForKey:@"orderData"]objectForKey:@"status"]isEqualToString:@"YI"]) {
        
        UIView*cancelRemarkView=[[UIView alloc]initWithFrame:CGRectMake(0, view6.bottom+10, ScreenWidth, 80)];
        cancelRemarkView.backgroundColor=[UIColor whiteColor];
        cancelRemarkView.layer.borderWidth = 0.40;
        cancelRemarkView.layer.borderColor = qianhuiColor.CGColor;
        [self addSubview:cancelRemarkView];
        
        UILabel*cancelRemark=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 120, 40)];
        cancelRemark.text=@"受理信息";
        cancelRemark.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemark setTextColor:qianheiColor];
        [cancelRemarkView addSubview:cancelRemark];
        
        NSString *cancelRemarks = [[model.dict objectForKey:@"orderData"]objectForKey:@"acceptRemark"];
        if (cancelRemarks.length>0) {
            
        }else{
            cancelRemarks=@"无";
            
        }
        
        CGSize cancelRemarksize = [cancelRemarks sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        UILabel*cancelRemarkLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, remarkLabel.bottom, ScreenWidth-40, cancelRemarksize.height+10)];
        cancelRemarkLabel.text=cancelRemarks;
        cancelRemarkLabel.numberOfLines=0;
        cancelRemarkLabel.font= [UIFont systemFontOfSize:contenfot];
        [cancelRemarkLabel setTextColor:shenhuiColor];
        [cancelRemarkView addSubview:cancelRemarkLabel];
        
        cancelRemarkView.frame=CGRectMake(0, view6.bottom+10, ScreenWidth, cancelRemarksize.height+70);
        _heightView.frame=CGRectMake(0, cancelRemarkView.bottom, ScreenWidth, 0.15);
        
        
    }

    
    else{
        view6.frame=CGRectMake(0, GoodView.bottom+10, ScreenWidth, labelsize1.height+70);
        _heightView.frame=CGRectMake(0, view6.bottom, ScreenWidth, 0.15);
      }
    
    
   
    
    
}
-(void)setViewAutoLayout
{
    [self.noLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.left.equalTo(self.mas_left).with.offset(15) ;
    make.height.equalTo(@17);
    make.top.equalTo(self.mas_top).with.offset(15);
}];

    
    [self.stateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.noLabel.mas_right).with.offset(7.5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.noLabel.mas_centerY) ;
    }];
    [self.stateLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.stateLabel.mas_right).with.offset(5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.noLabel.mas_centerY) ;
    }];

    [self.createName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.mas_top).with.offset(85/2);
    }];
    [self.createNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.createName.mas_right).with.offset(3) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.mas_top).with.offset(85/2);
    }];
    [self.orderDate mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.createNameLabel.mas_right).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.mas_top).with.offset(85/2);
    }];
    
    [self.orderDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.orderDate.mas_right).with.offset(3) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.mas_top).with.offset(85/2);
    }];
    
}


@end
